'// ========================================================================= '
'// ------------------------------------------------------------------------- '
'//!				\file		CST_PolyArea.vb
'			        \date		june 2010
'			        \author		TNick
'
'			        \brief		Dialog for 3D points settings
'
'
'   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'   This file is considered universal knowledge. No restrictions
'   are imposed; use as you see fit.
'   Please read ReadMe.txt and Licence.txt in root folder
'   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'
'   
'
'// ------------------------------------------------------------------------- '
'// ========================================================================= '
'//
'//
'//
'//
'//  IMPORTS     ------------------------------------------------------------ '
#Region "Imports"

    Imports System.Windows.Forms
    Imports Autodesk.AutoCAD

#End Region
'//  IMPORTS     ============================================================ '
'//
'//
'//
'//
'//  DEFINITIONS    --------------------------------------------------------- '




'//  DEFINITIONS    ========================================================= '
'//
'//
'//
'//
'//  DATA    ---------------------------------------------------------------- '


'//  DATA    ================================================================ '
'//
'//
'//
'//
'//  CLASS    --------------------------------------------------------------- '

Public Class PROGRESS

    '// --------------------------------------------------------------------- '
    '// DATA

	Private bStop As Boolean
   '// ===================================================================== '


    ' /////////////////////////////////////////////////////////////////////////
    #Region "Private functions"

    #End Region
    ' /////////////////////////////////////////////////////////////////////////





    ' /////////////////////////////////////////////////////////////////////////
    #Region "Public functions"

    '// --------------------------------------------------------------------- '
	Public Sub InitPgb(ByRef sDescr As String, _
	                   ByVal iMin As Integer, _
	                   ByVal iMax As Integer)
		Me.prProgress.Minimum = iMin
		Me.prProgress.Maximum = iMax
		Me.prProgress.Value = iMin
		bStop = False
		Me.lbInfo.Text = sDescr
		Me.lbPerc.Text = "0.00%"

        ApplicationServices.Application.ShowModelessDialog(Me)
	End Sub
    '// ===================================================================== '

    '// --------------------------------------------------------------------- '
	Public Sub EndPgb()
		Me.Close()
		bStop = True
	End Sub
    '// ===================================================================== '

    '// --------------------------------------------------------------------- '
	Public Function StepPgb(ByVal iStep As Integer) As Boolean
        If (Me.prProgress.Value >= Me.prProgress.Maximum) Then Return bStop
		Me.prProgress.Value = Me.prProgress.Value + iStep
        Dim prc As Double = _
          CDbl(Me.prProgress.Value - Me.prProgress.Minimum) / _
          CDbl(Me.prProgress.Maximum - Me.prProgress.Minimum)
        
		Me.lbPerc.Text = prc.ToString("0.00%")
        'Me.lbInfo.Refresh()
        'Me.lbPerc.Refresh()
        Me.Refresh()
		Return bStop
	End Function
    '// ===================================================================== '

    '// --------------------------------------------------------------------- '
	Public Function SetPgb(ByVal iVal As Integer) As Boolean
		Me.prProgress.Value = iVal
        Dim prc As Double = _
          (CDbl(Me.prProgress.Value - Me.prProgress.Minimum) / _
          CDbl(Me.prProgress.Maximum - Me.prProgress.Minimum))
		Me.lbPerc.Text = prc.ToString("0.00%")
		Return bStop
	End Function
    '// ===================================================================== '

    '// --------------------------------------------------------------------- '
	Public Sub SetMinMax(ByVal iValMin As Integer, ByVal iValMax As Integer)

        Me.prProgress.Maximum = iValMax
        Me.prProgress.Minimum = iValMin
        Dim prc As Double = _
          (CDbl(Me.prProgress.Value - Me.prProgress.Minimum) / _
          CDbl(Me.prProgress.Maximum - Me.prProgress.Minimum))
		Me.lbPerc.Text = prc.ToString("0.00%")
    End Sub
    '// ===================================================================== '

    '// --------------------------------------------------------------------- '
    Public Sub SetDescription(ByRef sDescr as String)
        Me.lbInfo.Text = sDescr
    End Sub
    '// ===================================================================== '

    #End Region
    ' /////////////////////////////////////////////////////////////////////////





    ' /////////////////////////////////////////////////////////////////////////
    #Region "Event handlers"

    '// --------------------------------------------------------------------- '
	Private Sub Cancel_Button_Click( _
	    ByVal sender As System.Object, _
        ByVal e As System.EventArgs) _
        Handles Cancel_Button.Click
		
        bStop = True
	End Sub
    '// ===================================================================== '

    '// --------------------------------------------------------------------- '
    Private Sub PROGRESS_Load( _
        ByVal sender As System.Object,  _
        ByVal e As System.EventArgs) _
        Handles MyBase.Load

        Me.Text = CMain._T(TX.PROGRESS) & ":"
        Me.Cancel_Button.Text = CMain._T(TX.CANCEL)

    End Sub
    '// ===================================================================== '

    #End Region
    ' /////////////////////////////////////////////////////////////////////////








End Class

'//  CLASS    =============================================================== '
'//
'//
'//
'//
'//  FUNCTIONS    ----------------------------------------------------------- '

'//  FUNCTIONS    =========================================================== '
'//
'//
'//
'//
'// ------------------------------------------------------------------------- '
'// ========================================================================= '
